<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="/root">using System;
using System.Windows.Forms;
using <xsl:value-of select="root_namespace"/>.Business.Tables;
using <xsl:value-of select="root_namespace"/>.Forms.Lookup;

namespace <xsl:value-of select="root_namespace"/>
{
    internal static class LookupHelper
    {
        <xsl:for-each select="fk_lookup">
        public static bool TryGet<xsl:value-of select="table_class_name"/>(out <xsl:value-of select="table_class_name"/> item)
        {
            Cursor.Current = Cursors.WaitCursor;
            using (<xsl:value-of select="table_class_name"/>LookupForm form = new <xsl:value-of select="table_class_name"/>LookupForm())
            {
                Cursor.Current = Cursors.Default;
                form.ShowDialog();
                item = form.<xsl:value-of select="table_class_name"/>;
            }
            
            return (item != null);
        }

        </xsl:for-each>
    }
}
</xsl:template>
</xsl:stylesheet>